
var username;
function check() {
	username = $.trim($("#username").attr("value"));
	var password= $.trim($("#password").attr("value"));
	//检查输入
	var str="请输入";
	var isInput=1;
	if(""==username){
		str+= "用户名";
		isInput=0;
	}
	if(""==password){
		str+=" 密码";
		isInput=0;
	}
	if(isInput==0){
		alert(str);
	}else{
		var data={
		username:username,
		password:password
		};
		LoginServImpl.analysesEmployee(data,callback);
	}
	
}

function callback(msg) {
	
	if(msg=="1"||msg=="0"){
		var result="LoginServlet?result="+msg+"&username="+username;
		$("#form").attr("action",result);
		$("#form").submit();
	}else if("-2"==msg){
		alert("该用户不存在");
		$("#username").attr("value","")
		$("#password").attr("value","")
	}else if("-1"==msg){
		alert("密码不正确,请重新输入");
		$("#password").attr("value","")
		
	}
}
